'''
6.3.3 快速生成千份劳动合同
'''
import pandas as pd
from mailmerge import MailMerge

# 读取求职者基本信息Excel表
job_seekers = pd.read_excel('求职者.xlsx')
template = '合同.docx'
doc = MailMerge(template)

def merge(name):
    doc.merge(owner='二两',
        party_b=name,
        year='2020',
        month='9',
        day='28')
    doc.write(f'合同/{name}_合同.docx')

for i, name in job_seekers['name'].items():
    merge(name)

print('done!')